/*     */ package com.lmpop.trade.ti_caseanswer;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.dao.IbatisDbmImpl;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import com.lmpop.trade.ti_casepre.Ti_casepre;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_caseanswerInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_caseanswerInfo()
/*     */   {
/*  18 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  27 */     Ti_caseanswer Ti_caseanswer = new Ti_caseanswer();
/*  28 */     RandomID randomid = new RandomID();
/*  29 */     String answer_id = randomid.GenTradeId();
/*  30 */     Ti_caseanswer.setAnswer_id(answer_id);
/*  31 */     Ti_caseanswer.setCasepre_id(map.getString("casepre_id"));
/*  32 */     Ti_caseanswer.setAnswer_content(map.getString("answer_content"));
/*  33 */     Ti_caseanswer.setAnswer_user(map.getString("answer_user"));
/*     */ 
/*  35 */     String result_code = "0";
/*     */     try {
/*  37 */       insert(dbmMgr, Ti_caseanswer);
/*     */     } catch (ApplicationException e) {
/*  39 */       e.printStackTrace();
/*  40 */       result_code = "1";
/*     */     }
/*  42 */     map.setString("result_code", result_code);
/*  43 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_caseanswer Ti_caseanswer)
/*     */     throws ApplicationException
/*     */   {
/*  52 */     dbmMgr.update("insertTi_caseanswer", Ti_caseanswer);
/*     */   }
/*     */ 
/*     */   public String insert(Ti_caseanswer Ti_caseanswer) {
/*     */     try {
/*  57 */       DbmInterf dbmMgr = new IbatisDbmImpl();
/*  58 */       dbmMgr.update("insertTi_caseanswer", Ti_caseanswer);
/*  59 */       Ti_casepre casepre = new Ti_casepre();
/*  60 */       casepre.setId(Ti_caseanswer.getCasepre_id());
/*  61 */       casepre.setState("1");
/*  62 */       dbmMgr.update("updateTi_casepre", casepre);
/*  63 */       return "操作成功";
/*     */     } catch (Exception e) {
/*  65 */       e.printStackTrace();
/*  66 */     }return "操作失败";
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  77 */     String pkid_string = map.getString("pkid");
/*  78 */     String result_code = "0";
/*     */     try {
/*  80 */       if (!pkid_string.equals("")) {
/*  81 */         String[] pkStr = pkid_string.split("\\|");
/*  82 */         for (int i = 0; i < pkStr.length; i++) {
/*  83 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  87 */       e.printStackTrace();
/*  88 */       result_code = "1";
/*     */     }
/*  90 */     map.setString("result_code", result_code);
/*  91 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 100 */     dbmMgr.update("deleteTi_caseanswer", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 109 */     Ti_caseanswer Ti_caseanswer = new Ti_caseanswer();
/* 110 */     Ti_caseanswer.setAnswer_id(map.getString("answer_id"));
/* 111 */     Ti_caseanswer.setCasepre_id(map.getString("casepre_id"));
/* 112 */     Ti_caseanswer.setAnswer_content(map.getString("answer_content"));
/* 113 */     Ti_caseanswer.setAnswer_user(map.getString("answer_user"));
/*     */ 
/* 115 */     String result_code = "0";
/*     */     try {
/* 117 */       update(dbmMgr, Ti_caseanswer);
/*     */     } catch (ApplicationException e) {
/* 119 */       e.printStackTrace();
/* 120 */       result_code = "1";
/*     */     }
/* 122 */     map.setString("result_code", result_code);
/* 123 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_caseanswer Ti_caseanswer)
/*     */     throws ApplicationException
/*     */   {
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 142 */     Hashtable Ti_caseanswer = (Hashtable)obj;
/* 143 */     if (start == 0)
/* 144 */       start = 0;
/*     */     else {
/* 146 */       start = (start - 1) * limit;
/*     */     }
/* 148 */     Ti_caseanswer.put("start", Integer.valueOf(start));
/* 149 */     Ti_caseanswer.put("limit", Integer.valueOf(limit));
/* 150 */     List list = this.queryList.getList("getListByTi_caseanswerPage", Ti_caseanswer);
/* 151 */     return list;
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 162 */     Hashtable Ti_caseanswer = (Hashtable)obj;
/* 163 */     List list = this.queryList.getList("getCountByObjTi_caseanswer", Ti_caseanswer);
/* 164 */     int count = 0;
/* 165 */     if ((list != null) && (list.size() > 0)) {
/* 166 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 167 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 168 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 171 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 181 */     return this.queryList.getList("getTi_caseanswerByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_caseanswer.Ti_caseanswerInfo
 * JD-Core Version:    0.6.0
 */